package com.zkingsoft.plugin.tag;

import java.io.IOException;
import java.io.StringWriter;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.SimpleTagSupport;

import com.zkingsoft.pojo.UserPwoer;

/**
 * 自定义权限标签
 * 
 * @author jyy
 *
 */
public class UserPwoerTag extends SimpleTagSupport {

	private UserPwoer userPwoer;
	private Long fnId;
	private String value;

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	StringWriter sw = new StringWriter();
	String s = "";
	String b = "";

	public void doTag() throws JspException, IOException {
		fnId = Long.parseLong((String) getJspContext().getAttribute("fnId"));
		userPwoer = (UserPwoer) getJspContext().getAttribute("userPwoer");
		s = userPwoer.getPowers().get(fnId).getBtns() + ",";
		b = value;
		if ((userPwoer.getPowers().get(fnId).getBtns() + ",").indexOf(value + ",") != -1) {
			getJspBody().invoke(sw);
			getJspContext().getOut().println(sw.toString());
		}
	}

}
